/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!				\file		MdiDraw.h
				\date		june 2010
				\author		TNick

				\brief		Contains the definition of MdiDraw class and related


    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please read ReadMe.txt and Licence.txt in root folder
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    
*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef		__MDIDRAW_INC__
#define		__MDIDRAW_INC__
#ifdef		__cplusplus
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

class ExplMdl;


#include	<assert.h>

#include	<QtGui>
#include	<QMainWindow>
#include	<QSettings>

#include	"OGLDraw.h"

#include	<base/CC_Err.h>
#include	<base/CC_Draw.h>

/*  INCLUDES    ============================================================ */
//
//
//
//



/// Class representing a MDI drawing
/**
*
*/
class	MdiDraw	: /*public QMdiSubWindow*/ public QMdiSubWindow {
    Q_OBJECT

	//
	//
	//
	//
	/*  DEFINITIONS    --------------------------------------------------------- */

	enum	Flags	{
			NOFLAGS = 0,		/**< just to make things clear */

			UNTITLED,			/**< this is a new drawing that was never saved */

			FLAG_MAX			/**< all values above of equal to this
							are invalid */
		};
	/*  DEFINITIONS    ========================================================= */
	//
	//
	//
	//
	/*  DATA    ---------------------------------------------------------------- */

	// internal variables
private:
    /// holds a pointer to associated draw class
	CC_Draw*			pDraw;
    /// a string telling the name of the file that is loaded
	QString				pName;
	/// internal draw area
	class OGLDraw*		pDA;
	/// flags
	unsigned			uFlg;





	/*  DATA    ================================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ----------------------------------------------------------- */

	// constructors and destructors
public:
    // ---------------------------------------------------------------------
    /// extended constructor; creates a new file or opens one on the way
    MdiDraw(QWidget* parent = 0, QString pFile = "");

    /// the destructor
    virtual ~MdiDraw();
    // ---------------------------------------------------------------------



	/// tells if the constructor done it's job
public: inline bool InitOk(void)
		{ return (pDraw != NULL); }
	/// tells if the constructor done it's job
public: inline bool isUntitled(void)
		{ return (pDraw != NULL); }


	// public members
public:
    /// the function saves the file (if this is new, acts as saveAs()
    bool    save		(void);
    /// the function asks the user for a location and name, then saves the file
    bool    saveAs	(void);

    /// tells the name of the file or some form of untitled
	inline QString name	(void)	{return pName;}


	/// get a pointer to the model used in GUI representation
//public: inline ExplMdl* getGuiModel	(void)
//		{ assert(pDraw != NULL); return pDraw->getGuiModel(); };

	/// get a pointer to the model used in GUI representation
public: inline QAbstractItemModel* getStdIModel	(void)
		{ Q_ASSERT(pDraw != NULL); 
		return (QAbstractItemModel*)pDraw->getStdIModel(); };


	// internal slots
private slots:
	/// we need to change current view to model view
	void		switchview_model			(void);


	/* ========================================================================= */


	/*  FUNCTIONS    =========================================================== */
	//
	//
	//
	//

};	/*	class	MdiDraw	*/
//
//
//
//
#endif	//	__cplusplus
#endif	//	__MDIDRAW_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
